package net.onceface.application.assembler;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import net.onceface.application.dto.ClientProtectInfoDTO;
import net.onceface.core.domain.ClientProtectInfo;

public class ClientProtectInfoAssembler {

	public static ClientProtectInfoDTO toDTO(ClientProtectInfo clientProtectInfo){
		if(clientProtectInfo == null){
			return null;
		}
		ClientProtectInfoDTO result = new ClientProtectInfoDTO();
		result.setId(clientProtectInfo.getId());
		result.setVersion(clientProtectInfo.getVersion());
		result.setLevel(clientProtectInfo.getLevel());
		result.setLevelName(clientProtectInfo.getLevel().getLabel());
		result.setAvailableBalance(clientProtectInfo.getAvailableBalance());
		result.setBalance(clientProtectInfo.getBalance());
		result.setClientId(clientProtectInfo.getClientId());
		result.setHaveExp(clientProtectInfo.getHaveExp());
		result.setPoint(clientProtectInfo.getPoint());
		result.setTotalExp(clientProtectInfo.getTotalExp());
		return result;
	}
	
	public static ClientProtectInfo toEntity(ClientProtectInfoDTO clientProtectInfo){
		if(clientProtectInfo == null){
			return null;
		}
		ClientProtectInfo result = new ClientProtectInfo();
		result.setId(clientProtectInfo.getId());
		result.setVersion(clientProtectInfo.getVersion());
		result.setLevel(clientProtectInfo.getLevel());
		result.setAvailableBalance(clientProtectInfo.getAvailableBalance());
		result.setBalance(clientProtectInfo.getBalance());
		result.setClientId(clientProtectInfo.getClientId());
		result.setHaveExp(clientProtectInfo.getHaveExp());
		result.setPoint(clientProtectInfo.getPoint());
		result.setTotalExp(clientProtectInfo.getTotalExp());
		return result;
	}
	
	public static List<ClientProtectInfo>  toEntities(Collection<ClientProtectInfoDTO>  clientProtectInfos){
		if (clientProtectInfos == null) {
			return null;
		}
		List<ClientProtectInfo> results = new ArrayList<ClientProtectInfo>();
		for (ClientProtectInfoDTO each : clientProtectInfos) {
			results.add(toEntity(each));
		}
		return results;
	}
	
	public static List<ClientProtectInfoDTO>  toDTOs(Collection<ClientProtectInfo>  clientProtectInfos){
		if (clientProtectInfos == null) {
			return null;
		}
		List<ClientProtectInfoDTO> results = new ArrayList<ClientProtectInfoDTO>();
		for (ClientProtectInfo each : clientProtectInfos) {
			results.add(toDTO(each));
		}
		return results;
	}
}
